#include "UdpServer.hpp"
#include "Log.hpp"
#include "Dict.hpp"

int main(int args,char* argv[])
{
    if(args != 2)
    {
        std::cout << "you shoule enter: port" << std::endl;
        exit(1);
    }
    Enable_Console_Log_Strategy();
    uint16_t port = std::stoi(argv[1]);
    Dict d;
    d.DictInit();

    std::unique_ptr<UdpServe> usvr = std::make_unique<UdpServe>(port,[&d](const std::string& word ,InetAddr& client)->std::string{
        return d.Translate(word,client);
    });
    usvr->Init();
    usvr->start();

    return 0;
}